#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Taotie Ren
# import logging 
# 禁用日志模块
# logging.disable(logging.CRITICAL)
# logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')

# pyDraw.py - add draw file.
import os
from PIL import Image, ImageDraw, ImageFont
os.makedirs('Draw', exist_ok=True)
im = Image.new('RGBA', (200, 200), 'white')
draw = ImageDraw.Draw(im)

draw.line([(0, 0), (199, 0), (199, 199), (0, 199), (0, 0)], fill= 'black')
draw.rectangle((20, 30, 60, 60), fill='blue')
draw.ellipse((120, 30, 160, 60), fill='red')
draw.polygon(((57, 87), (79, 62), (94, 85), (120, 90), (103, 113)),fill= 'brown')
for i in range(100, 200, 10):
	draw.line([(i, 0), (200, i - 100)], fill='green')

im.save('Draw\\drawing.png')

imFont = Image.new('RGBA', (200, 200), 'white')
draw = ImageDraw.Draw(imFont)
draw.text((20, 150), 'Hello', fill='purple')
fontsFolder = 'FONT_FOLDER'  # e.g. '/Library/Fonts'
arialFont = ImageFont.truetype(os.path.join(fontsFolder, 'arial.ttf'), 32)
draw.text((100, 150), 'Howdy', fill='gray', font=arialFont)
imFont.save('Draw\\text.png')